<?php
/**
 * 注：此模板为自动生成模板，需要根据实际情况调整修改
 * 此模板对 无主键/单一主键 表的支持较好，联合主键表在下一版本开发
 */
namespace Data;

use Utils\MyException;

class Restaurant_balance {

    //数组
    private $array;


    public function __construct ($array){

        $this->array = $array;

        self::setDefault();

    }

    public function getArray() {
        return $this->array;
    }

    public function updateWithArray($array) {
        foreach($array as $key=>$value)
        {
            if(array_key_exists($key,$this->array))
            {
                $this->array = array_merge($this->array,array($key=>$value));
            }
        }
    }



    private function setDefault(){

        if(count($this->array)==0){
            self::setDATE("null");
            self::setRESTAURANT_ID("0");
            self::setFLOW_TYPE("0");
            self::setBALANCE_FLOW("0");
            self::setBALANCE("0");
            self::setCREATED_ON("");
            self::setCREATED_BY("0");
            self::setUPDATED_ON("");
            self::setUPDATED_BY("0");

        }
    }






    public function setDATE($value) {
        $this->array = array_merge ($this->array,array(
            'DATE' => $value));
    }
    public function getDATE(){

        return $this->array ['DATE'];
    }


    public function setRESTAURANT_ID($value) {
        $this->array = array_merge ($this->array,array(
            'RESTAURANT_ID' => $value));
    }
    public function getRESTAURANT_ID(){

        return $this->array ['RESTAURANT_ID'];
    }


    public function setFLOW_TYPE($value) {
        $this->array = array_merge ($this->array,array(
            'FLOW_TYPE' => $value));
    }
    public function getFLOW_TYPE(){

        return $this->array ['FLOW_TYPE'];
    }


    public function setBALANCE_FLOW($value) {
        $this->array = array_merge ($this->array,array(
            'BALANCE_FLOW' => $value));
    }
    public function getBALANCE_FLOW(){

        return $this->array ['BALANCE_FLOW'];
    }


    public function setBALANCE($value) {
        $this->array = array_merge ($this->array,array(
            'BALANCE' => $value));
    }
    public function getBALANCE(){

        return $this->array ['BALANCE'];
    }


    public function setCREATED_ON($value) {
        $this->array = array_merge ($this->array,array(
            'CREATED_ON' => $value));
    }
    public function getCREATED_ON(){

        return $this->array ['CREATED_ON'];
    }


    public function setCREATED_BY($value) {
        $this->array = array_merge ($this->array,array(
            'CREATED_BY' => $value));
    }
    public function getCREATED_BY(){

        return $this->array ['CREATED_BY'];
    }


    public function setUPDATED_ON($value) {
        $this->array = array_merge ($this->array,array(
            'UPDATED_ON' => $value));
    }
    public function getUPDATED_ON(){

        return $this->array ['UPDATED_ON'];
    }


    public function setUPDATED_BY($value) {
        $this->array = array_merge ($this->array,array(
            'UPDATED_BY' => $value));
    }
    public function getUPDATED_BY(){

        return $this->array ['UPDATED_BY'];
    }

    public function toInsertCSV() {
        $str="";

        // DATE
        $str .= self::getDATE().",";
        // RESTAURANT_ID
        $str .= "'". self::getRESTAURANT_ID()."',";
        // FLOW_TYPE
        $str .= "'". self::getFLOW_TYPE()."',";
        // BALANCE_FLOW
        $str .= "'". self::getBALANCE_FLOW()."',";
        // BALANCE
        $str .= "'". self::getBALANCE()."',";
        // CREATED_ON
        $str .= "now()" . ",";

        // CREATED_BY
        $str .= "'". self::getCREATED_BY()."',";
        // UPDATED_ON
        $str .= "now()" . ",";

        // UPDATED_BY
        $str .= "'". self::getUPDATED_BY() . "'";
        return $str;
    }

}